package tcp;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDir {
    public static void main(String[] args) throws IOException {
        //创建socket对象
        ServerSocket ss = new ServerSocket(1000);
        //等待客户端连接
        Socket accept = ss.accept();
        //获得输入流对象
        InputStream is = accept.getInputStream();
        int b;
        while ((b=is.read())!=-1){
            System.out.println((char) b);
        }
        is.close();
        ss.close();
    }
}
